package com.qst.util;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2016091700529626";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCeh60jjDXLPqtmgSAsGeW3lfXKIyjZpxfasJcrKSUW5epEmpe85GdKysbFNmbLUvNkfcex5+G4s3VRiUWSWNKOYoV8Y+AwLUHQSqNCW9cEUVmrDVVC07GpDd4DZcPKOE1W1VHPJkdeoHlUihd5lLOZjw1ZcziU/ypbj9fpoaoix3XCz7yrfvn7v1Pt+WEAisxMALSzBDYbM2nQnXJnWdz0Kfi3lDThqHfhOWW9f/CwDffBvufoY4V5qbdoC8+ZqG7DT5ldHKs6559k4Pdnj4Aakj4U+V9+Wl02YCtuR4cYU5xmdd4wE7htlWNHU+RvBoyNsHozits8P7SJDLjyx2ThAgMBAAECggEAaWo41El4v+S1Xt0AQrMZ0MEUBszobgqxTwdcDiQ2+In8BJBz0/RhRxedoyfwpMVM+Ya2EnPp4cLbgVNxgsYzhOC4eKWFPyPo/pOTCh491S4vHRIpnt1b5tlExyeVUNOtgc8prkB69s5ov7FvuLYL01GPg+qdNl6SkP4OidmpY6QIiq2naIeZvA1NNbqjGQnr+C8qdjBOQH9/Yf8tO6mlLIibJzcJw6NSnHSZr7KpWGUz0ywQEFv/EONMRgkrYqkedjr3r16+eXB9Joa7psQqu+WtyGEHrZD+Xl0XBICnMeboVEf1FufNvQ7FZY3pVen5UZx3b7tufmr8TFfDTmTwQQKBgQDOEittX9aq3T39zQ6l9L4E4KRRbM10nsgqJXwi4IWIC8B6gEo0f/Rf9NEAclu0CfUo+hR5QpP28N1ZlYU+2/hCTw45cUdEVhQ6KrdeFyIJBnzSbO+Bk0yWvQF/eqaLnSd/3uK73z2tVRFLS8rT6wZj0LCP30uGvaetjc0FC0dqWQKBgQDE8LZwBsw9u6aaHltI8yIcPTL7NphitDKey6E8YgtyNtGf0YskiNgSl0BcYt289PaWj1G7wiF/AlBT7AwZeuk5mVT9Ydp6cthfmXUf9seUym2b1noIONapguI1cbN3By0PzfdCxcc37g8MuC2Hyk2xnq7mwBuZxybIT8BmozVtyQKBgGEXUnq/8waiIvkXylUK0RS/OuxaVRsjTK/+5VQRcRi+YLvXAh9mQh+L24VYXDihkG70FP1lDw4EQmZY+mS5g2jKkqsh4jAiVnlpcufUAmc6NUl3pgjo++bxumjzwtB5BQlMXIukDQ1DzVgqp6/dRi91PhsrXAxqAzzUWMqNm+JRAoGAHopBkF/NfmlCLbY1a7ugd4aaCFDwEqZlDzD+wPFnWv/bRBBnpnO+JivkZC9EuY+3SaPSBe7V6O8/67O4MJ9Z2X/IqT5qdgCnQzP18M4BJza5Bqic5feCemj8kVMfhH7NYx0KkgU/npHBLbTGAr/BiqDT+J6j6RX0Eq4jZQc8OtkCgYEAwHGO++A7D/qcBKKDeFUHfS0fPdE//KzV01Fi61BxsYyzqaNeG1iOavoifclwJTnIGWSRE8Tutv/ziGsAnEPpMZkjKFKpHQ45Ixcl90GvTacjU5DXGknxgiSV7AAXWDlDhO3zyJCijtpGbf/ERlvUVlJcpB/2mHaDWwGM585o3fs=";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnoetI4w1yz6rZoEgLBnlt5X1yiMo2acX2rCXKyklFuXqRJqXvORnSsrGxTZmy1LzZH3HsefhuLN1UYlFkljSjmKFfGPgMC1B0EqjQlvXBFFZqw1VQtOxqQ3eA2XDyjhNVtVRzyZHXqB5VIoXeZSzmY8NWXM4lP8qW4/X6aGqIsd1ws+8q375+79T7flhAIrMTAC0swQ2GzNp0J1yZ1nc9Cn4t5Q04ah34TllvX/wsA33wb7n6GOFeam3aAvPmahuw0+ZXRyrOuefZOD3Z4+AGpI+FPlfflpdNmArbkeHGFOcZnXeMBO4bZVjR1PkbwaMjbB6M4rbPD+0iQy48sdk4QIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://localhost:8080/tushop2/WEB-INF/alipay/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://localhost:8080/return_url";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

